package com.goodluck.goodluckim.sdk.dispatcher.base;

import com.goodluck.goodluckim.db.model.WebSocketResult;
import com.goodluck.goodluckim.sdk.dispatcher.MessageDispatcherFactory;

public class MessageContext {
    private IMessageStrategy messageStrategy;
    private MessageDispatcherFactory messageDispatcherFactory;

    public MessageContext() {
        messageDispatcherFactory = new MessageDispatcherFactory();
    }

    public void dispatcher(WebSocketResult webSocketResult) {
        messageStrategy = messageDispatcherFactory.createMessageStrategy(webSocketResult.getAction());
        messageStrategy.dispatcher(webSocketResult.getData());
    }
}
